<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>浇铸抽检记录</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/layui.css"  media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/toastr.min.css"  media="all">
	
	<script type="text/javascript" src="${pageContext.request.contextPath }/assets/js/jquery.min.js" charset="utf-8"></script>
	<style type="text/css">
		.layui-form-label{
			width: 100px;
		}
		#jzSpotCheckDetails .layui-form-label{
			width: auto !important;
			padding:9px 15px 9px 5px !important;
		}
	</style>
</head>
<body>
<div class="demoTable" style="padding:10px 0 0 15px">
    <div class="layui-inline">
       	<input class="layui-input" id="keyword" style="width: 300px" placeholder="请输入检验批次序号查询"/>
    </div>
    <button class="layui-btn layui-btn-blue" style="margin: 0 0 0 10px" data-type="reload"><i class="layui-icon layui-icon-search">  搜索</i></button>
    <button class="layui-btn layui-btn-blue" style="float:right;margin-right: 20px;" id="statistics"><i class="layui-icon layui-icon-layouts">  查看统计表</i></button>
</div>
<!-- 上表 -->
<script type="text/html" id="toolbarDemo">
	<div class="layui-btn-container">
		<button class="layui-btn layui-btn-blue" lay-event="add"><i class="layui-icon layui-icon-add-1">  新增</i></button>
		<button class="layui-btn layui-btn-blue" lay-event="delete"><i class="layui-icon layui-icon-delete">  批量删除</i></button>
	</div>
</script>
<h2 style="text-align: center;color:#666">浇铸抽检单</h2>
<table class="layui-hide" id="jzSpotCheck" lay-filter="jzSpotCheck"></table>
<script type="text/html" id="barDemo">
	<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<!-- 下表有记录 -->
<script type="text/html" id="toolbarDemoDetails">
	<div class="layui-btn-container">
		<button class="layui-btn layui-btn-blue" lay-event="addDetails"><i class="layui-icon layui-icon-add-1">  新增</i></button>
	</div>
</script>
<div id="detailsTitle" class="layui-hide">
	<h2 style="text-align: center;color:#666">抽检单详情</h2>
	<table class="layui-hide" id="jzSpotCheckDetailsAlready" lay-filter="jzSpotCheckDetailsAlready"></table>
</div>
<!-- 下表无记录 -->
<div id="jzSpotCheckDetails" hidden>
	<h2 style="text-align: center;color:#666">填写抽检单详情</h2>
	<form onkeydown="if(event.keyCode==13){return false}" class="layui-form layui-card-body" id="addFormIdChild">
		<table class="layui-table">
			<thead>
				<tr>
					<td colspan="2">
						<div class="layui-form-item"><label class="layui-form-label">检验批次序号</label><input class="layui-input" readonly lay-verify="orderNumberText" id="orderNumberText" name="orderNumber" type="text" value="" style="width:60%;"></div>
					</td>
					<td colspan="2">
						<div class="layui-form-item"><label class="layui-form-label">组件编号</label><input class="layui-input" lay-verify="zjNumber" id="zjNumber" name="zjNumber" type="text" value="" style="width:60%;"></div>
					</td>
					<td colspan="1">
						<div class="layui-form-item"><label class="layui-form-label">组件型号</label><input class="layui-input" lay-verify="zjModel" id="zjModel" name="zjModel" type="text" value="" style="width:60%;"></div>
					</td>
				</tr>
				<tr>
					<th>检验项目</th>
					<th>标准值</th>
					<th>实际值</th>
					<th>处理意见</th>
					<th>备注</th>
				</tr>
			</thead>
			<tbody id="tbody">
			
			</tbody>
			<tfoot>
				<tr>
					<td colspan="5">
						<div class="layui-form-item">
							<button id="subBtn2" class="layui-btn layui-btn-blue" lay-submit lay-filter="addformChild">提交</button>
							<button type="button" id="cancel" class="layui-btn layui-btn-blue" >取消</button>
							<button type="reset" id="addReset" class="layui-btn layui-btn-primary layui-hide" >重置</button>
						</div>
					</td>
				</tr>
			</tfoot>
		</table>
		
		
	</form>
</div>

<script src="${pageContext.request.contextPath }/assets/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/layui.all.js"></script>
<script src="${pageContext.request.contextPath }/assets/js/toastr.min.js" charset="utf-8"></script>
<script type="text/javascript">
//日期格式转换1
function createTime(v){
	var date = new Date(v);
    var y = date.getFullYear();
    var M = date.getMonth()+1;
    M = M<10?'0'+M:M;
    var d = date.getDate();
    d = d<10?("0"+d):d;
    var h = date.getHours();
    h = h<10?("0"+h):h;
    var m = date.getMinutes();
    m = m<10?("0"+m):m;
    var str = y+"-"+M+"-"+d+" "+h+":"+m;
    return str;
}
//日期格式转换2
function date2String(timestamp){
	var d = new Date(timestamp);
	var date = (d.getFullYear()) + "-" + 
       (d.getMonth() + 1<10?"0"+(d.getMonth() + 1):d.getMonth() + 1) + "-" +
       (d.getDate()<10?"0"+d.getDate():d.getDate()) + " " + 
       (d.getHours()<10?"0"+d.getHours():d.getHours()) + ":" + 
       (d.getMinutes()<10?"0"+d.getMinutes():d.getMinutes()) + ":" + 
       (d.getSeconds()<10?"0"+d.getSeconds():d.getSeconds());
       
       return date;
}
layui.use(['table','layer','upload','form','laydate'], function(){
	var table = layui.table;
	var layer = layui.layer,
    form = layui.form,laydate=layui.laydate;
	
	var $ = layui.jquery, active = {
			reload:function () {
				var keyword = $("#keyword").val();
				table.reload('contenttable',{
					method:'get',
					where:{keyword:keyword}
					,page: {
						curr: 1 //重新从第 1 页开始
					}
				});
			}
		}
	$('.layui-btn').on('click', function(){
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
	table.render({
	    elem: '#jzSpotCheck'
	    ,url:'${pageContext.request.contextPath }/jzSpotCheck/selectJzSpotCheckList.do'
	    ,toolbar: '#toolbarDemo'
	    ,title: '浇铸抽检单'
	    ,id :'contenttable'
	    ,limits:[10,20,30]
	    ,cols: [[
		  {type: 'checkbox', fixed: 'left',width:50}
		  ,{field:'', title:'序号', sort: true, type:'numbers', width: 60}
	      ,{field:'orderNumber', title:'检验批次序号'}
	      ,{field:'checkPerson', title:'检验员'}
	      ,{field:'checkDate', title:'检验时间',templet:function(row){
	    	  return date2String(row.checkDate.time);
	      }}
	      ,{fixed: 'right', title:'操作', toolbar: '#barDemo',width:150}
	    ]]
	    ,page: true
	});
	
	//头工具栏事件
	table.on('toolbar(jzSpotCheck)', function(obj){
		var checkStatus = table.checkStatus(obj.config.id);
		var content = 	'<form class="layui-form layui-card-body" id="addFormId">'+
							'<div class="layui-form-item"><label class="layui-form-label">检验批次序号</label><input class="layui-input" lay-verify="orderNumber" id="orderNumber" name="orderNumber" type="text" value="" style="width:300px;"></div>'+
							'<div class="layui-form-item"><label class="layui-form-label">检验日期</label>'+
								'<input class="layui-input layui-input-inline" lay-verify="checkDate" id="checkDate" name="checkDate" type="text" value="" style="width:300px;">'+
								'<div class="layui-inline" style="margin-top: 12px;">'+
									'<font style="color:red; font-size: 24px;">*</font>'+
								'</div>'+
							'</div>'+
					  		'<div class="layui-form-item"><div class="layui-input-block">'+
								'<button id="subBtn1" class="layui-btn layui-btn-blue" lay-submit lay-filter="addform">提交</button><button type="reset" id="addReset" class="layui-btn layui-btn-primary" style="margin-left:140px">重置</button>'+
							'</div></div>'+
						'</form>';
	    switch(obj.event){
	    	case 'add':
	    		layer.open({
					  type: 1 		//Page层类型
					  ,area: ['500px', '300px'] //宽  高
					  ,title: '新增'
					  ,shade: 0.1 	//遮罩透明度
					  ,maxmin: true //允许全屏最小化
					  ,anim: 1 		//0-6的动画形式，-1不开启
					  ,content: content
					  ,success:function(layero, index){
						  form.render();
							//日期
							laydate.render({
							   elem: '#checkDate'
							   ,type: 'datetime'
							});
							this.enterEsc = function(event){
		  				          if(event.keyCode === 13){
		  				            return false; //阻止系统默认回车事件
		  				          }
		  			        	}; 
		  			        $(document).on('keydown', this.enterEsc);
					  }
				});
	      	break;
	    	case 'delete':
	        	var data = checkStatus.data;
	        	var idArr = new Array();
	        	if(data.length==0){
	        		toastr.warning("请至少选择一条记录！");
	        	}
	        	var idArr = new Array();
	        	for(var i=0;i<data.length;i++){
	        		idArr[i] = data[i].jzId;
	    		    layer.confirm('确定删除吗？', function(index){
	    			    $.ajax({
	    			    	type:'post',
	    			    	url:'${pageContext.request.contextPath }/jzSpotCheck/delJzSpotCheckArr.do',
	    			    	data:{"idArr":idArr},
	    			    	success:function(num){
	    			    		if(num>0){
	    			    			toastr.success("删除了"+num+"条数据！");
	    			    			setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
	    								//关闭模态框
	    								// 父页面刷新
	    								window.location.reload();  
	    							},2000);
	    			    		}else{
	    			    			toastr.warning("删除失败！");
	    			    		}
	    			    	}
	    			    		
	    			    })
	    			    layer.close(index);
	    			  });
	        	}
	      	break;
	    };
	});
  
	//监听行工具事件
	table.on('tool(jzSpotCheck)', function(obj){
		var data = obj.data;
		if(obj.event === 'del'){
		  layer.confirm('确定删除吗？', function(index){
			var idArr = new Array();
		    var jzId = data.jzId;
		    idArr[0] = jzId;
		    $.ajax({
		    	type:'post',
		    	url:'${pageContext.request.contextPath }/jzSpotCheck/delJzSpotCheckArr.do',
		    	data:{"idArr":idArr},
		    	success:function(data){
		    		if(data>0){
		    			toastr.success("删除成功！");
		    			setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
							//关闭模态框
							// 父页面刷新
							window.location.reload();  
						},2000);
		    		}else{
		    			toastr.warning("删除失败！");
		    		}
		    	}
		    		
		    })
		    layer.close(index);
		  });
		} else if(obj.event === 'edit'){
			var content1 = '<form class="layui-form layui-card-body" id="editFormId">'+
								'<input class="layui-hide" name="jzId" value="'+data.jzId+'">'+
								'<div class="layui-form-item"><label class="layui-form-label">检验批次序号</label><input class="layui-input" lay-verify="orderNumber" id="orderNumber" name="orderNumber" type="text" value="'+data.orderNumber+'" style="width:300px;"></div>'+
								'<div class="layui-form-item"><label class="layui-form-label">检验日期</label>'+
									'<input class="layui-input layui-input-inline" lay-verify="checkDate" id="checkDate" name="checkDate" type="text" value="'+date2String(data.checkDate.time)+'" style="width:300px;">'+
									'<div class="layui-inline" style="margin-top: 12px;">'+
										'<font style="color:red; font-size: 24px;">*</font>'+
									'</div>'+
								'</div>'+
								'<div class="layui-form-item"><div class="layui-input-block">'+
									'<button class="layui-btn layui-btn-blue" lay-submit lay-filter="editform">提交</button><button type="reset" id="editReset" class="layui-btn layui-btn-primary" style="margin-left:140px">重置</button>'+
								'</div></div>'+
							'</form>';
			layer.open({
				  type: 1 		//Page层类型
				  ,area: ['500px', '300px'] //宽  高
				  ,title: '修改'
				  ,shade: 0.1 	//遮罩透明度
				  ,maxmin: true //允许全屏最小化
				  ,anim: 1 		//0-6的动画形式，-1不开启
				  ,content: content1
				  ,success:function(layero, index){
					  form.render();
						//日期
						laydate.render({
						   elem: '#checkDate'
						   ,type: 'datetime'
						});
						this.enterEsc = function(event){
	  				          if(event.keyCode === 13){
	  				            return false; //阻止系统默认回车事件
	  				          }
	  			        	}; 
	  			        $(document).on('keydown', this.enterEsc);
				  }
			});
		}
	});
	
	//监听行单击事件(子表)
	 table.on('row(jzSpotCheck)', function(obj){
		var orderNumber = obj.data.orderNumber;
		$("#detailsTitle").removeClass("layui-hide");
		table.render({
		    elem: '#jzSpotCheckDetailsAlready'
		    ,url:'${pageContext.request.contextPath }/jzSpotCheck/selectJzSpotCheckDetailsListByNumber.do'
		    ,where:{ptNumber: orderNumber}
		    ,title: '浇铸抽检详情单'
		    ,toolbar: '#toolbarDemoDetails'
		    ,limits:[10,20,30]
		    ,cols: [[
		    	{field:'orderNumber', title:'检验批次序号' }
			     ,{field:'zjNumber', title:'组件编号'}
			     ,{field:'zjModel', title:'组件型号'}
			     ,{field:'checkItem', title:'检验项'}
			     ,{field:'standardValue', title:'标准值'}
			     ,{field:'realityValue', title:'实际值'}
			     ,{field:'idea', title:'处理意见'}
			     ,{field:'remark', title:'备注'}
		    ]]
		    ,page: true
		    ,done : function(res, curr, count) {
		        merge(res);
		 	}
		});
		//头工具栏事件
		table.on('toolbar(jzSpotCheckDetailsAlready)', function(obj){
			var checkStatus = table.checkStatus(obj.config.id);
		    switch(obj.event){
		    	case 'addDetails':
		    		layer.open({
						  type: 1 		//Page层类型
						  ,area: ['90%', '600px'] //宽  高
						  ,title: '新增'
						  ,shade: 0.1 	//遮罩透明度
						  ,maxmin: true //允许全屏最小化
						  ,anim: 1 		//0-6的动画形式，-1不开启
						  ,content:  $('#jzSpotCheckDetails')
						  ,success:function(layero, index){
							  form.render();
							  $("#tbody").empty();
								$("#orderNumberText").val(orderNumber);
								$.ajax({
									type:'post'
									,url:'${pageContext.request.contextPath }/criterion/selectJzSpotCheckCriterionList.do?page=1&&limit=99999'
									,dataType:'json'
									,success:function(res){
										var length = res.data.length;
										for(var i = 0;i<length;i++){
											$("#tbody").append(
												'<tr>'+
													'<td>'+
														'<input class="layui-input" name="checkItem" type="text" readonly value="'+res.data[i].checkItem+'" />'+
													'</td>'+
													'<td>'+
														'<input class="layui-input" name="standardValue" type="text" readonly value="'+res.data[i].checkCriterion+'" />'+
													'</td>'+
													'<td>'+
														'<input class="layui-input" name="realityValue" type="number" value=""/>'+
													'</td>'+
													'<td>'+
														'<input class="layui-input" name="idea" type="text" value=""/>'+
													'</td>'+
													'<td>'+
														'<input class="layui-input" name="remark" type="text" value=""/>'+
													'</td>'+
												'</tr>'
											)
										}
									}
								})
						  }
			    		,end:function(){
		    				$("#jzSpotCheckDetails").hide();
		    				$("#addReset").click();
		    			}
					});
		      	break;
		    };
		});
		function merge(res) {
	        var data = res.data;
	        var mergeIndex = 0;//定位需要添加合并属性的行数
	        var mark = 1; //这里涉及到简单的运算，mark是计算每次需要合并的格子数
	        var columsName = ['orderNumber','zjNumber','zjModel'];//需要合并的列名称
	        var columsIndex = [0,1,2];//需要合并的列索引值
	    
	        for (var k = 0; k < columsName.length; k++) { //这里循环所有要合并的列
	            var trArr = $("#detailsTitle .layui-table-body>.layui-table").find("tr");//所有行
	                for (var i = 1; i < res.data.length; i++) { //这里循环表格当前的数据
	                    var tdCurArr = trArr.eq(i).find("td").eq(columsIndex[k]);//获取当前行的当前列
	                    var tdPreArr = trArr.eq(mergeIndex).find("td").eq(columsIndex[k]);//获取相同列的第一列
	                    
	                    if (data[i][columsName[k]] === data[i-1][columsName[k]]) { //后一行的值与前一行的值做比较，相同就需要合并
	                        mark += 1;
	                        tdPreArr.each(function () {//相同列的第一列增加rowspan属性
	                            $(this).attr("rowspan", mark);
	                        });
	                        tdCurArr.each(function () {//当前行隐藏
	                            $(this).css("display", "none");
	                        });
	                    }else {
	                        mergeIndex = i;
	                        mark = 1;//一旦前后两行的值不一样了，那么需要合并的格子数mark就需要重新计算
	                    }
	                }
	            mergeIndex = 0;
	            mark = 1;
	        }
	    }
	});
	/**
     * 表单校验
     */
    form.verify({
    	//value：表单的值、item：表单的DOM对象
    	checkDate: function(value, item){
    		if(value == ''){
    			return '日期不能为空';
    		}
    	}
    })
    /**
     * 通用表单提交(AJAX方式)（新增）
     */
    form.on('submit(addform)', function (data) {
    	$("#subBtn1").attr("disabled",true);
    	$.ajax({
			type : "post",
			url : '${pageContext.request.contextPath}/jzSpotCheck/insertJzSpotCheck.do',
			data : $("#addFormId").serialize(),
			cache : false,
			async:false
			}).done(
				function(res) {
					if (res > 0) {
						toastr.success('新增成功！');
					}
					setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
						//关闭模态框
						// 父页面刷新
						window.location.reload();  
					},2000);
				}
			).fail(
				function(res) {
					toastr.error('新增失败！');
				}
			)
			return false;
    });
    /**
     * 通用表单提交(AJAX方式)(修改)
     */
    form.on('submit(editform)', function (data) {
    	$.ajax({
			url : '${pageContext.request.contextPath}/jzSpotCheck/updateJzSpotCheck.do',
			data : $("#editFormId").serialize(),
			cache : false,
			async:false
			/* 
				success: function (data) {},
				error: function (XMLHttpRequest, textStatus, errorThrown) {},
				beforeSend: function () {},
				complete: function () {} 
			 */
			}).done(
				function(res) {
					if (res == 1) {
						toastr.success('修改成功！');
					}
					setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
						//关闭模态框
						// 父页面刷新
						window.location.reload();  
					},2000);
				}
			).fail(
				function(res) {
					toastr.error('修改失败！');
				}
			)
			return false;
    });
    function keyDown(e){
	    //IE内核浏览器  
	     if (navigator.appName == 'Microsoft Internet Explorer'){  
	           var keycode = event.keyCode;  
	           var realkey = String.fromCharCode(event.keyCode);  
	     }else {//非IE内核浏览器  
	           var keycode = e.which;  
	           var realkey = String.fromCharCode(e.which);  
	     }  

	   //监听Enter键  
	   if(keycode==13){
		   	var zjNumber = $("#zjNumber").val();
		   	if(zjNumber==''){
		   		
		   	}else if(zjNumber.length != 16 || zjNumber[1].toUpperCase() != 'P' || zjNumber[2].toUpperCase() != 'S'){
		   		toastr.warning("请扫描正确的组件条码！");
		   		$("#zjNumber").val("");
		   	}else{
		   		var number = zjNumber.substring(3,7);
		   		$.ajax({
					type : "post",
					url : '${pageContext.request.contextPath}/jzSpotCheck/selectPcarByNumber.do',
					data : {"number":number},
					cache : false,
					async:false,
					success:function(res){
						$("#zjModel").val(res);
					}
				})
		   	}
	   }  
	   
	}  
	//按键事件
	document.onkeydown=keyDown;
    /**
     * 通用表单提交(AJAX方式)（新增子表）
     */
    form.on('submit(addformChild)', function (data) {
    	$("#subBtn2").attr("disabled",true);
    	var zjNumber = $("#zjNumber").val();
	   	if(zjNumber.length != 16 || zjNumber[1].toUpperCase() != 'P' || zjNumber[2].toUpperCase() != 'S'){
	   		toastr.warning("请扫描正确的组件条码！");
	   		$("#zjNumber").val("");
	   		$("#subBtn2").attr("disabled",false);
	   	}else{
	   		$.ajax({
				type : "post",
				url : '${pageContext.request.contextPath}/jzSpotCheck/insertJzSpotCheckDetails.do',
				data : $("#addFormIdChild").serialize(),
				cache : false,
				async:false
				}).done(
					function(res) {
						if (res > 0) {
							toastr.success('新增成功！');
						}
						setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
							//关闭模态框
							// 父页面刷新
							window.location.reload();  
						},2000);
					}
				).fail(
					function(res) {
						toastr.error('新增失败！');
					}
				)
	   	}
		return false;
    });
    $("#cancel").click(function(){
		layer.closeAll();
	})
}); 
//查看统计表
$("#statistics").click(function(){
	   layer.open({
	        type: 1 					//Page层类型
	        ,area: ['95%', '600px']   //宽  高
	        ,title: '浇铸抽检统计表'
	        ,shade: 0.6 				//遮罩透明度
	        ,maxmin: true			    //允许全屏最小化
	        ,anim: 1 					//0-6的动画形式，-1不开启
	        /* ,content: $("#lookupTable2") */
	        ,content: '<table class="layui-hide" id="statisticsTable" lay-filter="statisticsTable"></table>'
	        ,success:function(){
	            layui.use(['table'], function(){
	                var table = layui.table;
	                table.render({
	                    elem: '#statisticsTable'
	                    ,url:'${pageContext.request.contextPath }/jzSpotCheck/selectJzSpotCheckStatisticsTable.do'
	                    ,title: '浇铸抽检统计表'
	                    ,limits:[10,20,30]
	                    ,cols: [[
	                        {field:'', title:'序号', sort: true, type:'numbers', width: 60}
	                        ,{field:'orderNumber', title:'检测批次序号'}
	                        ,{field:'checkItem', title:'检测项'}
	                        ,{field:'realityValue', title:'检测项平均值'}
	                    ]]
	                    ,page: true
	                    ,done : function(res, curr, count) {
	        		        merge1(res);
	        		 	}
	                });
	            });
	        }
		})
		function merge1(res) {
	        var data = res.data;
	        var mergeIndex = 0;//定位需要添加合并属性的行数
	        var mark = 1; //这里涉及到简单的运算，mark是计算每次需要合并的格子数
	        var columsName = ['','orderNumber'];//需要合并的列名称
	        var columsIndex = [0,1];//需要合并的列索引值
	    
	        for (var k = 0; k < columsName.length; k++) { //这里循环所有要合并的列
	            var trArr = $(".layui-layer .layui-table-body>.layui-table").find("tr");//所有行
	                for (var i = 1; i < res.data.length; i++) { //这里循环表格当前的数据
	                    var tdCurArr = trArr.eq(i).find("td").eq(columsIndex[k]);//获取当前行的当前列
	                    var tdPreArr = trArr.eq(mergeIndex).find("td").eq(columsIndex[k]);//获取相同列的第一列
	                    
	                    if (data[i][columsName[k]] === data[i-1][columsName[k]]) { //后一行的值与前一行的值做比较，相同就需要合并
	                        mark += 1;
	                        tdPreArr.each(function () {//相同列的第一列增加rowspan属性
	                            $(this).attr("rowspan", mark);
	                        });
	                        tdCurArr.each(function () {//当前行隐藏
	                            $(this).css("display", "none");
	                        });
	                    }else {
	                        mergeIndex = i;
	                        mark = 1;//一旦前后两行的值不一样了，那么需要合并的格子数mark就需要重新计算
	                    }
	                }
	            mergeIndex = 0;
	            mark = 1;
	        }
	    }
					
})
toastr.options.positionClass = 'toast-top-center'; //提示框的位置设置为中上
</script>
</body>
</html>